import request from '@/utils/request'

// 查询零星采购单列表
export function listpfmMstr(query) {
  return request({
    url: '/purchase/pfmMstr/list',
    method: 'get',
    params: query
  })
}

// 查询零星采购单明细列表
export function listPfDdet(pfdDjbh) {
  return request({
    url: '/purchase/pfmMstr/listPfDdet/' + pfdDjbh,
    method: 'get'
  })
}

// 查询零星采购单详细
export function getpfmMstr(pfmId) {
  return request({
    url: '/purchase/pfmMstr/' + pfmId,
    method: 'get'
  })
}

// 新增零星采购单
export function addpfmMstr(data) {
  return request({
    url: '/purchase/pfmMstr',
    method: 'post',
    data: data
  })
}

// 修改零星采购单
export function updatepfmMstr(data) {
  return request({
    url: '/purchase/pfmMstr',
    method: 'put',
    data: data
  })
}

// 添加-查询
export function searchData(query) {
  return request({
    url: '/purchase/pfmMstr/searchData',
    method: 'get',
    params: query
  })
}

//添加-确认
export function saveDate(data) {
  return request({
    url: '/purchase/pfmMstr/saveDate',
    method: 'post',
    data: data
  })
}

// 删除子项数据
export function pfdDetDel(pfdId, pfdQfdh) {
  return request({
    url: '/purchase/pfmMstr/pfdDetDel/' + pfdId + '/' + pfdQfdh,
    method: 'delete'
  })
}

export function submitPfM(pfmId) {
  return request({
    url: '/purchase/pfmMstr/submitPfM/' + pfmId,
    method: 'post'
  })
}

export function checkPfM(pfmId) {
  return request({
    url: '/purchase/pfmMstr/checkPfM/' + pfmId,
    method: 'post'
  })
}

export function backPfm(pfmId, reson) {
  return request({
    url: '/purchase/pfmMstr/backPfm/' + pfmId + '/' + reson,
    method: 'put'
  })
}

// 删除零星采购单
export function delpfmMstr(pfmId) {
  return request({
    url: '/purchase/pfmMstr/' + pfmId,
    method: 'delete'
  })
}

// 删除零星采购单
export function invalidChild(pfdId) {
  return request({
    url: '/purchase/pfmMstr/invalidChild/' + pfdId ,
    method: 'put'
  })
}



// 报表
export function pfmReportList(query) {
  return request({
    url: '/purchase/pfmMstr/pfmReport',
    method: 'get',
    params: query
  })
}

export function exportTotalList(query) {
  return request({
    url: '/purchase/pfmMstr/export',
    method: 'get',
    params: query
  })
}
